<?php
//图片缩略图模块
namespace Kuoqi\FileDriver;
use Kuoqi\Config;
use Kuoqi\Params;
use Kuoqi\Route;

/**
 * 路径信息
 * Class Path
 * @package Kuoqi\FileDriver
 */
class Path{

    /**
     * 获取缓存路径
     * @param bool $isCommon 是否公共文件夹，默认是
     * @return string 返回路径字符串
     */
    static public function getCache($isCommon = true){
        if(\Kuoqi::$app&&(!$isCommon)){
            $extrapath = '/'.\Kuoqi\Route::hump2code(\Kuoqi::$app->route->m);
        }
        $url = '/' . Params::$RUNTIME_PATH .($isCommon?'':($extrapath)). '/' . Params::$CACHE_PATH;
        return $url;
    }

    //获取数据库公共文件夹
    static public function getDatabase($isCommon = true){
        if(\Kuoqi::$app&&(!$isCommon)){
            $extrapath = '/'.\Kuoqi\Route::hump2code(\Kuoqi::$app->route->m);
        }
        $url = '/' . Params::$RUNTIME_PATH .($isCommon?'':($extrapath)). '/database';
        return $url;
    }

    //获取runtime文件夹
    static public function getRuntime($isCommon = true,$ext_path = ''){
        if(\Kuoqi::$app&&(!$isCommon)){
            $extrapath = '/'.\Kuoqi\Route::hump2code(\Kuoqi::$app->route->m);
        }

        $url = '/' . Params::$RUNTIME_PATH .($isCommon?'':($extrapath)). \Kuoqi\Route::hump2code($ext_path);
        return $url;
    }

}